package cn.edu.xust.controller;

import cn.edu.xust.configuration.exception.Default200Exception;
import cn.edu.xust.service.SysMenuService;
import cn.edu.xust.service.SysMenuprivilegeService;
import cn.edu.xust.util.R;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;


/**
 * @author ufo
 * @email 2575829997@qq.com
 * @date 2022-09-06 17:32:09
 */
@RestController
@RequestMapping("/sysmenu")
public class SysMenuController {
    @Autowired
    private SysMenuService sysMenuService;
    @Autowired
    private SysMenuprivilegeService sysMenuprivilegeService;


    //删除菜单
    @ResponseBody
    @RequestMapping(value = "/del")
    public R eletimerange(@RequestBody JSONObject jsonObject) throws Default200Exception {
        String menuids = jsonObject.getString("menuids");
        String[] menulist = menuids.split(",");
        List<String> list = Arrays.asList(menulist);
        boolean b = sysMenuService.removeByIds(list);
        int i = sysMenuprivilegeService.removeByMenuids(list);
        return R.ok();
    }




}
